<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>8</title>
</head>
<body>
<script>
  /*
    在控制台打印出一个五行的直角三角形和等腰三角形
    *     *
   **    ***
  ***   *****
 ****  *******
  */
  var str="";
  for (let i = 0; i < 4; i++) {
      //1.画空格
      for (let j = 0; j < 4-i-1; j++) {
          str+=" ";
      }
      //2.画*
      for (let j = 0; j <=i; j++) {
          str+="*";
      }
      //3.画换行
      str+="\n";
  }
  console.log(str);
  console.log("-----")
  var str1="";
  for (let i = 0; i < 4; i++) {
      //1.画空格
      for (let j = 0; j <4-i-1; j++) {
          str1+=" ";
      }
      //2.画*
      for (let j = 0; j <=i*2; j++) {
          str1+="*";
      }
      //3.画空格
      for (let j = 0; j < 4 - i - 1; j++) {
          str1+=" ";
      }
      //4.画换行
      str1+="\n";
  }
  console.log(str1)

</script>
</body>
</html>